<html>
<head><meta charset="utf-8"><title>Backtrace vs dyn Backtrace · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Backtrace.20vs.20dyn.20Backtrace.html">Backtrace vs dyn Backtrace</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="224249935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Backtrace%20vs%20dyn%20Backtrace/near/224249935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Ashley Mannix <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Backtrace.20vs.20dyn.20Backtrace.html#224249935">(Jan 27 2021 at 21:27)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> Had the background thread going in our Libs meeting on "Why come up with a weird dyn-like scheme instead of just using <code>dyn Trait</code>?". I try to avoid exposing <code>dyn Trait</code> publicly because it's limiting:</p>
<ul>
<li>You have to either box or have a <code>dyn Trait</code> to return to satisfy lifetimes</li>
<li>You can't combine it with other traits</li>
<li>You're limited to a subset of APIs to retain object safety</li>
</ul>
<p>In libraries where I've used <code>dyn Trait</code> heavily I've never yet regretted encapsulating it in the public API. So I think the <code>RawWaker</code>-like scheme for <code>Backtrace</code> buys us flexibility.</p>



<a name="224250144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Backtrace%20vs%20dyn%20Backtrace/near/224250144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Backtrace.20vs.20dyn.20Backtrace.html#224250144">(Jan 27 2021 at 21:28)</a>:</h4>
<p>And we can't Box/Rc things in core.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>